home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Text / Misc / TextloaderTNG / Rexx / SendtoPageLiner.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1999-09-02  |  2.2 KB  |  94 lines

  1. /*  Send text from TLNG to PageLiner     */
  2. /*  Change Pagestream3: to PageStream4:  */
  3. /*  if you are using PageStream4!!!      */
  4. /*  PL-V1.0 © 13.03.99 by Jochen Grus    */
  5.  
  6. OPTIONS RESULTS
  7. TRACE OFF
  8.  
  9. /* Make sure rexx support is opened */
  10. IF ~SHOW('L','rexxsupport.library') THEN
  11.    CALL ADDLIB('rexxsupport.library',0,-30)
  12.  
  13.  
  14. /* set the default PageLiner path , should be changed to 4 if you are using PGS4*/
  15. plpath='PageStream3:PageLiner'
  16. preffile='PageStream3:SendtoPageLiner.prefs'
  17.  
  18. /* If PageLiner doesn't exist in the default path, check SendtoPageLiner.prefs */
  19. if ~exists(plpath) then do
  20.     if open(.ifile, preffile, 'R') then do
  21.         plpath=readln(.ifile)
  22.         call close(.ifile)
  23.         askuser='no'
  24.         end
  25.     else do
  26.         askuser='yes'
  27.     end
  28.     /* If PageLiner doesn't exist in the set pref path, ask the user where it is */
  29.     if ~exists(plpath) | askuser='yes' then do
  30.         getfile TITLE "'Please locate PageLiner'" load path "'PageStream3:'" file 'PageLiner' posbutton 'Ok' negbutton 'Cancel'
  31.         if RC=10 then signal cancel
  32.         plpath=result
  33.         if open(.ifile, preffile, 'W') then do
  34.             call writeln(.ifile, plpath)
  35.             call close(.ifile)
  36.         end
  37.     end
  38. end
  39.  
  40.  
  41. /* Run PageLiner */
  42. ADDRESS COMMAND
  43. 'run >nil:' PLpath
  44.  
  45. /* Wait until the ARexx port shows up */
  46. do 20
  47.     if ~show(P, 'PAGELINER') then call delay(50)
  48. end
  49.  
  50. /* If the ARexx port didn't show up, alert the user and exit */
  51. if ~show(P, 'PAGELINER') then do
  52.     ADDRESS 'PAGESTREAM'
  53.     allocarexxrequester '"Send to Editor Error!"' 368 59
  54.     reqhandle=result
  55.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  56.         Exithandle=result
  57.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'PageLiner could not be started.'"
  58.     doarexxrequester reqhandle
  59.     freearexxrequester reqhandle
  60.     'refresh continue'
  61.     'lockinterface false'
  62.     EXIT
  63. end
  64.  
  65. ADDRESS 'PAGELINER'
  66. 'open ram:clipboards/0'
  67. 'cursor down'
  68.  
  69. /* Wait for the user to finish in PageLiner */
  70. do forever
  71.     if show(P, 'PAGELINER') then do
  72.         'getarticle ram:clipboards/0'
  73.         if rc=0 then call delay(50)
  74.         else signal update
  75.     end
  76.     else signal update
  77. end
  78.  
  79. /* Update PageStream and exit */
  80.  
  81. 'inserttext file ram:clipboards/0'
  82.  
  83. /* deselect the text if rquired */
  84. if sID=eID then selecttext none
  85.  
  86. signal cancel
  87.  
  88. CANCEL:
  89. ADDRESS 'PAGESTREAM'
  90. 'refresh continue'
  91. 'lockinterface false'
  92. ADDRESS COMMAND
  93. EXIT
  94.